package com.fun.feifun.modules.business.model.xml;

import com.fun.feifun.base.utils.MD5Util;
import com.fun.feifun.base.utils.format.FormatUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.xml.bind.annotation.XmlRootElement;
import java.util.HashMap;
import java.util.Map;

/**
 * @author wukefei
 * @date $ $
 */
@Data
public class OrderJson {

    @ApiModelProperty(value = "商户id")
    private String mch_id;

    @ApiModelProperty(value = "YYYY-mm-dd HH:ii:ss")
    private String time;

    @ApiModelProperty(value = "签名")
    private String sign;

    public String MD5Sign(String key) {
        String encrypt ="";
        try {
            Map<String,String> map=new HashMap<>();
            map.put("mch_id",this.mch_id);
            map.put("time",this.time);
            map.put("key",key);
            String SignJson = FormatUtil.objToJson(map);
            encrypt = MD5Util.encrypt(SignJson);
        }catch (Exception e){
            e.printStackTrace();
        }
        return encrypt;
    }
}
